package com.lmt.config;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

/**
 * Date 2018/06/28
 *
 * @author MT-Lin
 */
@Component
public class CustomUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        if ("user".equals(username)) {
            return new SecurityUser("user", "password", "role-user");
        } else if ("admin".equals(username)) {
            return new SecurityUser("admin", "password", "role-admin");
        }
        return null;
    }

}
